﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Linq.Expressions;

namespace IDAL
{
    public interface IBaseDAL<T>where T:class,new()
    {
        /// <summary>
        /// 查询数据
        /// </summary>
        /// <param name="whereLambda"></param>
        /// <returns></returns>
        IQueryable<T> LoadData(Expression<Func<T, bool>> whereLambda);
        /// <summary>
        /// 分页数据
        /// </summary>
        /// <typeparam name="c">排序类型</typeparam>
        /// <param name="pageIndex">当前页</param>
        /// <param name="pageSize">显示条数</param>
        /// <param name="totalCount">总页数</param>
        /// <param name="whereLambda">查询条件</param>
        /// <param name="orderbyLambda">排序条件</param>
        /// <param name="isAsc">是否倒序</param>
        /// <returns></returns>
        IQueryable<T> Paging<c>(int pageIndex, int pageSize, out int totalCount, Expression<Func<T, bool>> whereLambda, Expression<Func<T, c>> orderbyLambda, bool isAsc);
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="entity">实体模型</param>
        void DeleteSign(T entity);
        /// <summary>
        /// 修改数据
        /// </summary>
        /// <param name="entity">实体模型</param>
        void EditSign(T entity);
        /// <summary>
        /// 添加数据
        /// </summary>
        /// <param name="entity">实体模型</param>
        /// <returns>返回插入成功后的实体模型</returns>
        T AddSing(T entity);

    }
}
